package algo;

/**
 *
 * @author robin
 */
//node = block on the map, reachable from other nodes
public class Node {
    public final Integer block;
    private Integer distance;
    private Node parent;
    private boolean isStart = false;
    private boolean isEnd = false;

    public Node(Integer block) {
        this.block = block;
    }

    public void setParent(Node parent) {
        this.parent = parent;
    }

    public Node getParent() {
        return parent;
    }

    public void setStart() {
        this.isStart = true;
    }

    public boolean isStart() {
        return isStart;
    }

    public void setEnd() {
        this.isEnd = true;
    }

    public boolean isEnd() {
        return isEnd;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }

        Node other = (Node) obj;
        if (block == null) {
            if (other.block != null) {
                return false;
            }
        } else if (!block.equals(other.block)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((block == null) ? 0 : block.hashCode());
        return result;
    }

    /**
     *
     * @return
     */
    public Integer getDistance() {
        return distance;
    }

    /**
     *
     * @param distance
     */
    public void setDistance(Integer distance) {
        this.distance = distance;
    }
}